<?php
require_once 'Smithy/Form.php';

/**
 * Form with a table layout.
 *
 * @author Kovács Tamás
 * @category Smithy
 * @package Smithy_Form
 */
class Smithy_Form_Table extends Smithy_Form
{
    /**
     * The default decorators for form elements.
     *
     * @var array
     */
    protected static $_elementDecorators = array(
        'ViewHelper',
        array(array('data' => 'HtmlTag'), array('tag' => 'td', 'class' => 'element')),
        array('Label', array('tag' => 'td', 'class' => 'label')),
        array(array('row' => 'HtmlTag'), array('tag' => 'tr'))
    );

    /**
     * The default decorators for form buttons.
     *
     * @var array
     */
    protected static $_buttonDecorators = array(
        'ViewHelper',
        array(array('data' => 'HtmlTag'), array('tag' => 'td', 'class' => 'button-element')),
        array(array('Label' => 'HtmlTag'), array('tag' => 'td', 'placement' => 'prepend', 'class' => 'label')),
        array(array('row' => 'HtmlTag'), array('tag' => 'tr'))
    );

    /**
     * The default decorators for the form.
     *
     * @var array
     */
    protected static $_formDecorators = array(
        'FormElements',
        array('HtmlTag', array('tag' => 'table')),
        'Form'
    );


    /**
     * @see Smithy_Form::loadDefaultDecorators()
     */
    public function loadDefaultDecorators() {
        $this->setDecorators(self::$_formDecorators);
    }
}
